@inject Eqwww.App.Identity.UserApp UserApp

@{
    ViewData["Title"] = "修改系统头像";
    Layout = "~/Views/Shared/_ManageFormLayout.cshtml";

    var user=UserApp.GetUserAsync(User).Result;
}

<form id="form1" class="mdui-m-t-3 mdui-m-b-3">
    
    <div class="mdui-container">

        <div class="mdui-row">

            <style type="text/css">
                .eq-avatar-choose-box img{
                    width:64px;
                    cursor:pointer;
                }
                .eq-avatar-choosed-box img{
                    width:128px;
                }
            </style>
            <div class="mdui-col-xs-12">
                <div class="mdui-typo-body-2">用户头像</div>
                <div class="eq-avatar-choose-box">
                    <img src="~/images/avatars/default.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-11.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-12.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-13.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-14.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-15.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-16.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-17.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-18.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-19.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-20.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-21.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-22.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-23.png" class="mdui-img-circle" />
                    <img src="~/images/avatars/avatar-24.png" class="mdui-img-circle" />
                </div>
                <div class="eq-avatar-choosed-box">
                    <img src="@user.Avatar" class="mdui-img-circle" />
                </div>
                <input type="hidden" id="Avatar" name="Avatar" value="@user.Avatar" />

                
            </div>

        </div>

    </div>
</form>

@section Scripts {
    <script>
        $(function () {
            $('.eq-avatar-choose-box img').click(function () {
                var $this = $(this);
                $('.eq-avatar-choosed-box img').attr('src', $this.attr('src'));
                $('#Avatar').val($this.attr('src'));
            });
        });

        function submitForm(index) {
            
            var postData = $('#form1').formSerialize();

            $.submitForm({
                url: "/SystemManage/MyAccount/AvatarSubmit",
                param: postData,
                success: function () {
                    top.frames['layui-layer-iframe' + index].location.reload();
                    $.modalClose();
                }
            });

        };
    </script>
}